package com.zzh.phone.hviews;

import android.content.Context;
import android.view.View;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.zzh.lib.views.adapter.DragBaseAdapter;
import com.zzh.lib.views.adapter.holder.HSuperViewHolder;

/**
 * Created by ZZH on 2022/5/29.
 *
 * @Date: 2022/5/29
 * @Email: zzh_hz@126.com
 * @QQ: 1299234582
 * @Author: zzh
 * @Description:
 */
public class DragAdapter extends DragBaseAdapter<ImageModel> {

    public DragAdapter(Context ctx) {
        super(ctx);
    }


    @Override
    public int getLayoutId() {
        return R.layout.item_img;
    }

    @Override
    public void onBindItemHolder(HSuperViewHolder holder, int position) {
        ImageView view = holder.getView(R.id.aiv_img);
        Glide.with(view).load(getItem(position).url).into(view);
        view.setOnLongClickListener(new View.OnLongClickListener() {
            @Override
            public boolean onLongClick(View v) {
                if (getOnItemDragClickListener() != null) {
                    getOnItemDragClickListener().onLongClickBook(holder, position);
                }
                return true;
            }
        });
    }
}
